package zb.blog.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zb.blog.base.bean.Result;
import zb.blog.bean.PrivateAccountBean;
import zb.blog.service.PrivateAccountService;

import java.util.Map;

@RestController
@RequestMapping("/privateAccount/back")
public class PrivateAccountController {
    @Autowired
    private PrivateAccountService privateAccountService;

    @RequestMapping("/list")
    public PageInfo<PrivateAccountBean> list(@RequestBody Map<String,String> param){
        return privateAccountService.list(param);
    }

    @RequestMapping("/add")
    public Result add(@RequestBody PrivateAccountBean privateAccountBean){
        return privateAccountService.add(privateAccountBean);
    }

    @RequestMapping("/deleteById")
    public Result deleteById(Integer id){
        return privateAccountService.deleteById(id);
    }

    @RequestMapping("/updateById")
    public Result updateById(@RequestBody PrivateAccountBean privateAccountBean){
        return  privateAccountService.updateById(privateAccountBean);
    }

    @RequestMapping("/getById")
    public PrivateAccountBean getById(Integer id){
        return privateAccountService.getById(id);
    }
}
